Page({
  data: {
    categories: [],
    rightData: []
  },
  onLoad: function () {
    this.getCateGories()
  },
  getCateGories: async function () {
    let { data } = await wx.categoriesApi.getCategories();
    console.log(data)
    this.cates = data.message
    this.setData({
      categories: data.message,
      rightData: data.message[0].children
    })
  },
  changeRight(e) {
    console.log(e)
    var idx = e.currentTarget.dataset.idx
    this.setData({
      rightData: this.cates[idx].children
    })
  }
})